﻿/*
 * Created by SharpDevelop.
 * User: IEscarro
 * Date: 9/7/2009
 * Time: 9:07 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using Buaya.Util;
using Buaya.Gui;
using System.IO;
using Buaya.Model;

namespace Buaya.Commands
{
	public class ExitCommand : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.Close();
		}
	}
	
	public class ShowHomePage : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddChild(new WebBrowserForm(Path.Combine(ApplicationUtility.DocDirectory, "home.html")), "Home Page");
		}
	}
	
	public class LogOff : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.LogOff();
		}
	}
	
	public class ToggleWindowListPane : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.ToggleWindowListPane();
		}
	}
	
	public class ToggleIconBar : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.ToggleIconBar();
		}
	}
	
	public class UseCalculator : AbstractCommand
	{
		public override void Run()
		{
			System.Diagnostics.Process.Start("calc");
		}
	}
	
	public class ViewDailyTimeRecorder : AbstractCommand
	{
		public override void Run()
		{
			if (File.Exists("dtr.exe")) {
				System.Diagnostics.Process.Start("dtr");
			} else {
				Util.MessageService.ShowInfo(
					"You might not have installed the daily time recorder. " + Environment.NewLine +
					"Please try again or contact your administrator."
				);
			}
		}
	}
	
	public class ShowPreferences : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddDialog(new PreferencesForm());
		}
	}
	
	public class ListUsers : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddDialog(new UserListForm());
		}
	}
	
	public class ChangePassword : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddDialog(new ChangePasswordForm(UserSingleton.Instance));
		}
	}
	
	public class ListToDos : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddChild(new ToDoListForm());
		}
	}
	
	public class ShowCompanyInformation : AbstractCommand
	{
		public override void Run()
		{
			MainForm.Instance.AddDialog(new CompanyForm(CompanySingleton.Instance));
		}
	}
}
